import zipfile
import os
import sys

def extract_zip(zip_path, output_dir):
    if not os.path.isfile(zip_path):
        print(f"ZIP file dose not exist {zip_path}")
        return

    try:
        with zipfile.ZipFile(zip_path, 'r') as zip_ref:
            zip_ref.extractall(output_dir)
        print(f"extracted to: {output_dir}")
    except zipfile.BadZipFile:
        print("Err: It's not a zip file")
    except Exception as e:
        print(f"Err: {e}")

if __name__ == "__main__":
    if len(sys.argv) != 3:
        print("Usage: python unzip_util.py <zip_file> <output_dir>")
        sys.exit(1)

    zip_file = sys.argv[1]
    output_dir = sys.argv[2]

    extract_zip(zip_file, output_dir)